{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Importing Libraries"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/javascript": [
       "IPython.notebook.set_autosave_interval(120000)"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Autosaving every 120 seconds\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "%matplotlib inline\n",
    "\n",
    "import matplotlib\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "import tqdm\n",
    "\n",
    "from tqdm._tqdm_notebook import tqdm_notebook as tqdm\n",
    "# from tqdm import trange\n",
    "tqdm.pandas(desc=\"apply bar\")\n",
    "import codecs\n",
    "\n",
    "%autosave 120"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Importing Data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Data Description\n",
    "\n",
    "Source: Sampled public tweets from Twitter streaming API.\n",
    "Date range: March 24, 2012 to April 25, 2012.\n",
    "Data size: 178 MB\n",
    "Contains:\n",
    "\n",
    "    Anonymized reciprocal follower/retweet/mention network of the same group of users;\n",
    "    The sequence of adopters and timestamps for observed hashtags.\n",
    "\n",
    "**** NETWORKS ****\n",
    "\n",
    "##### follower_gcc.anony.dat:\n",
    "Format: anony.user1.ID anony.user2.ID\n",
    "\n",
    "Anonymized reciprocal follower network.\n",
    "Each edge is a pair of Twitter user who are following each other. After recovering the reciprocal follower network, the giant connected component is extracted.\n",
    "\n",
    "##### retweet_gcc.anony.dat:\n",
    "Format: anony.user1.ID anony.user2.ID weight\n",
    "\n",
    "Anonymized reciprocal retweet network.\n",
    "Similarly to follower_gcc.anony.dat, but instead each edge is a pair of users who retweeted each other at least once during our observation time window. Weight is the sum of how many times user1 retweeted user2 or user2 retweeted user1.\n",
    "\n",
    "##### mention_gcc.anony.dat:\n",
    "Format: anony.user1.ID anony.user2.ID weight\n",
    "\n",
    "Anonymized reciprocal retweet network.\n",
    "Similarly to follower_gcc.anony.dat, but instead each edge is a pair of users who mentioned each other at least once during our observation time window. Weight is the sum of how many times user1 mentioned user2 or user2 mentioned user1.\n",
    "\n",
    "\n",
    "**** HASHTAG SEQUENCES ****\n",
    "\n",
    "##### timeline_tag.anony.dat\n",
    "\n",
    "Format: hashtag timestamp1,anony.user1.id timestamp2,anony.user2.id ...\n",
    "\n",
    "Each line is a hashtag followed by the sequence of its adopters sorted by timestamp. A user is considered as an adopter of a hashtag once he/she starts using the hashtag. We only consider users who appear in the collected networks. The timestamp is the time when we see the hashtag in the user's tweets. The file includes both emergent hashtags and non-emergent ones.\n",
    "\n",
    "##### timeline_tag_rt.anony.dat\n",
    "\n",
    "Format: hashtag timestamp1,anony.retweet_user1.id,anony.retweet_from_user1.id\n",
    "timestamp2,anony.retweet_user2.id,anony.tweet_from_user2.id ...\n",
    "\n",
    "Each line is a hashtag followed by the sequence of its adopters retweeting about this hashtag from other users sorted by timestamp. A \"retweet_user\" retweets a message containing the hashtag from a \"retweet_from_user\". We only consider users who appear in the collected networks. The file includes both emergent hashtags and non-emergent ones.\n",
    "\n",
    "##### timeline_tag_men.anony.dat\n",
    "\n",
    "Format: hashtag timestamp1,anony.mention_user1.id,anony.mentioned_user1.id timestamp2,anony.mention_user2.id,anony.mentioned_user2.id ...\n",
    "\n",
    "Each line is a hashtag followed by the sequence of its adopters mentioning other users in messages containing this hashtags sorted by timestamp. A \"mention_user\" mentions a \"mentioned_user\" in a message with the target hashtag. We only consider users who appear in the collected networks. The file includes both emergent hashtags and non-emergent ones."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### follower_gcc.anony.dat"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>user1</th>\n",
       "      <th>user2</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   user1  user2\n",
       "0      0      1\n",
       "1      0      2\n",
       "2      0      3\n",
       "3      0      4\n",
       "4      0      5"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_follower=pd.read_table(\"/nfs/maciej/twitter/Prediction_of_Viral_Memes_on_Twitter/follower_gcc.anony.dat\",header=None,delim_whitespace=True)\n",
    "df_follower.columns=['user1','user2']\n",
    "df_follower.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### retweet_gcc.anony.dat"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>user1</th>\n",
       "      <th>user2</th>\n",
       "      <th>weight</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>37</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>483</td>\n",
       "      <td>487</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>483</td>\n",
       "      <td>23002</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>348</td>\n",
       "      <td>362</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>348</td>\n",
       "      <td>359</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   user1  user2  weight\n",
       "0      0     37       2\n",
       "1    483    487       2\n",
       "2    483  23002       4\n",
       "3    348    362       2\n",
       "4    348    359       3"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_retweet=pd.read_table(\"/nfs/maciej/twitter/Prediction_of_Viral_Memes_on_Twitter/retweet_gcc.anony.dat\",header=None,delim_whitespace=True)\n",
    "df_retweet.columns=['user1', 'user2','weight']\n",
    "df_retweet.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### mention_gcc.anony.dat"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>user1</th>\n",
       "      <th>user2</th>\n",
       "      <th>weight</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>16</td>\n",
       "      <td>13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>67</td>\n",
       "      <td>212</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>348</td>\n",
       "      <td>359</td>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>429</td>\n",
       "      <td>452</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>429</td>\n",
       "      <td>473</td>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   user1  user2  weight\n",
       "0      0     16      13\n",
       "1     67    212       3\n",
       "2    348    359       8\n",
       "3    429    452       9\n",
       "4    429    473       7"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_mention=pd.read_table(\"/nfs/maciej/twitter/Prediction_of_Viral_Memes_on_Twitter/mention_gcc.anony.dat\",header=None,delim_whitespace=True)\n",
    "df_mention.columns=['user1', 'user2','weight']\n",
    "df_mention.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### timeline_tag.anony.dat"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "t=df_tag.groupby(\"tag\").count()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/opt/conda/lib/python3.6/site-packages/ipykernel_launcher.py:1: FutureWarning: sort(columns=....) is deprecated, use sort_values(by=.....)\n",
      "  \"\"\"Entry point for launching an IPython kernel.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ts</th>\n",
       "      <th>user</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>tag</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>00000000000gcf</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricanfavorite</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricanfemales</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricangirlprobz</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricangrandmaprobs</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricanlifestyles</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricanlunch</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricanpowerbaby</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricanprobems</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricanproblem</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricanproblemas</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricanrum</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricansadie</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricansaturdays</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricanskills</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricanfact</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricanslisteningtomusic</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricansthesedays</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricanstyle</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricansuperhero</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricantopic</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricapride</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricawants1d</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricodontwantyounomo</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricoinstagram</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoriconeedsbelievetour</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricooooo</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricostandup</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricowantsbelievetour</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>puertoricowantsyou</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>sagittarius</th>\n",
       "      <td>25836</td>\n",
       "      <td>25836</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20thingsilove</th>\n",
       "      <td>26097</td>\n",
       "      <td>26097</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>pisces</th>\n",
       "      <td>26615</td>\n",
       "      <td>26615</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>nfb</th>\n",
       "      <td>26659</td>\n",
       "      <td>26659</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>imagine</th>\n",
       "      <td>26882</td>\n",
       "      <td>26882</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>aries</th>\n",
       "      <td>27785</td>\n",
       "      <td>27785</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>nowplaying</th>\n",
       "      <td>27832</td>\n",
       "      <td>27832</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>shoutout</th>\n",
       "      <td>28887</td>\n",
       "      <td>28887</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>cancer</th>\n",
       "      <td>28904</td>\n",
       "      <td>28904</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>gemini</th>\n",
       "      <td>28939</td>\n",
       "      <td>28939</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>fb</th>\n",
       "      <td>29070</td>\n",
       "      <td>29070</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>capricorn</th>\n",
       "      <td>29885</td>\n",
       "      <td>29885</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>wheniwaslittle</th>\n",
       "      <td>30193</td>\n",
       "      <td>30193</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>winning</th>\n",
       "      <td>30933</td>\n",
       "      <td>30933</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>followback</th>\n",
       "      <td>31757</td>\n",
       "      <td>31757</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>lt</th>\n",
       "      <td>32226</td>\n",
       "      <td>32226</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>taurus</th>\n",
       "      <td>35309</td>\n",
       "      <td>35309</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>nw</th>\n",
       "      <td>35323</td>\n",
       "      <td>35323</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>lrt</th>\n",
       "      <td>35357</td>\n",
       "      <td>35357</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>retweet</th>\n",
       "      <td>39097</td>\n",
       "      <td>39097</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dearoomf</th>\n",
       "      <td>40894</td>\n",
       "      <td>40894</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>yolo</th>\n",
       "      <td>50256</td>\n",
       "      <td>50256</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>thoughtsduringschool</th>\n",
       "      <td>50927</td>\n",
       "      <td>50927</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rt</th>\n",
       "      <td>51735</td>\n",
       "      <td>51735</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>bahrain</th>\n",
       "      <td>59277</td>\n",
       "      <td>59277</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>teamfollowback</th>\n",
       "      <td>83064</td>\n",
       "      <td>83064</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ff</th>\n",
       "      <td>123875</td>\n",
       "      <td>123875</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>nf</th>\n",
       "      <td>128920</td>\n",
       "      <td>128920</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>np</th>\n",
       "      <td>158608</td>\n",
       "      <td>158608</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>oomf</th>\n",
       "      <td>363518</td>\n",
       "      <td>363518</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1345913 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                  ts    user\n",
       "tag                                         \n",
       "00000000000gcf                     1       1\n",
       "puertoricanfavorite                1       1\n",
       "puertoricanfemales                 1       1\n",
       "puertoricangirlprobz               1       1\n",
       "puertoricangrandmaprobs            1       1\n",
       "puertoricanlifestyles              1       1\n",
       "puertoricanlunch                   1       1\n",
       "puertoricanpowerbaby               1       1\n",
       "puertoricanprobems                 1       1\n",
       "puertoricanproblem                 1       1\n",
       "puertoricanproblemas               1       1\n",
       "puertoricanrum                     1       1\n",
       "puertoricansadie                   1       1\n",
       "puertoricansaturdays               1       1\n",
       "puertoricanskills                  1       1\n",
       "puertoricanfact                    1       1\n",
       "puertoricanslisteningtomusic       1       1\n",
       "puertoricansthesedays              1       1\n",
       "puertoricanstyle                   1       1\n",
       "puertoricansuperhero               1       1\n",
       "puertoricantopic                   1       1\n",
       "puertoricapride                    1       1\n",
       "puertoricawants1d                  1       1\n",
       "puertoricodontwantyounomo          1       1\n",
       "puertoricoinstagram                1       1\n",
       "puertoriconeedsbelievetour         1       1\n",
       "puertoricooooo                     1       1\n",
       "puertoricostandup                  1       1\n",
       "puertoricowantsbelievetour         1       1\n",
       "puertoricowantsyou                 1       1\n",
       "...                              ...     ...\n",
       "sagittarius                    25836   25836\n",
       "20thingsilove                  26097   26097\n",
       "pisces                         26615   26615\n",
       "nfb                            26659   26659\n",
       "imagine                        26882   26882\n",
       "aries                          27785   27785\n",
       "nowplaying                     27832   27832\n",
       "shoutout                       28887   28887\n",
       "cancer                         28904   28904\n",
       "gemini                         28939   28939\n",
       "fb                             29070   29070\n",
       "capricorn                      29885   29885\n",
       "wheniwaslittle                 30193   30193\n",
       "winning                        30933   30933\n",
       "followback                     31757   31757\n",
       "lt                             32226   32226\n",
       "taurus                         35309   35309\n",
       "nw                             35323   35323\n",
       "lrt                            35357   35357\n",
       "retweet                        39097   39097\n",
       "dearoomf                       40894   40894\n",
       "yolo                           50256   50256\n",
       "thoughtsduringschool           50927   50927\n",
       "rt                             51735   51735\n",
       "bahrain                        59277   59277\n",
       "teamfollowback                 83064   83064\n",
       "ff                            123875  123875\n",
       "nf                            128920  128920\n",
       "np                            158608  158608\n",
       "oomf                          363518  363518\n",
       "\n",
       "[1345913 rows x 2 columns]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "t.sort_values(by=['ts'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "e7129c38454849dcab61b9c6d1dfbf25",
       "version_major": 2,
       "version_minor": 0
      },
      "text/html": [
       "<p>Failed to display Jupyter Widget of type <code>HBox</code>.</p>\n",
       "<p>\n",
       "  If you're reading this message in Jupyter Notebook or JupyterLab, it may mean\n",
       "  that the widgets JavaScript is still loading. If this message persists, it\n",
       "  likely means that the widgets JavaScript library is either not installed or\n",
       "  not enabled. See the <a href=\"https://ipywidgets.readthedocs.io/en/stable/user_install.html\">Jupyter\n",
       "  Widgets Documentation</a> for setup instructions.\n",
       "</p>\n",
       "<p>\n",
       "  If you're reading this message in another notebook frontend (for example, a static\n",
       "  rendering on GitHub or <a href=\"https://nbviewer.jupyter.org/\">NBViewer</a>),\n",
       "  it may mean that your frontend doesn't currently support widgets.\n",
       "</p>\n"
      ],
      "text/plain": [
       "HBox(children=(IntProgress(value=1, bar_style='info', max=1), HTML(value='')))"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "0a7c447843d24c4e9e62d086dcb02ea4",
       "version_major": 2,
       "version_minor": 0
      },
      "text/html": [
       "<p>Failed to display Jupyter Widget of type <code>HBox</code>.</p>\n",
       "<p>\n",
       "  If you're reading this message in Jupyter Notebook or JupyterLab, it may mean\n",
       "  that the widgets JavaScript is still loading. If this message persists, it\n",
       "  likely means that the widgets JavaScript library is either not installed or\n",
       "  not enabled. See the <a href=\"https://ipywidgets.readthedocs.io/en/stable/user_install.html\">Jupyter\n",
       "  Widgets Documentation</a> for setup instructions.\n",
       "</p>\n",
       "<p>\n",
       "  If you're reading this message in another notebook frontend (for example, a static\n",
       "  rendering on GitHub or <a href=\"https://nbviewer.jupyter.org/\">NBViewer</a>),\n",
       "  it may mean that your frontend doesn't currently support widgets.\n",
       "</p>\n"
      ],
      "text/plain": [
       "HBox(children=(IntProgress(value=0, description='apply bar', max=12054205), HTML(value='')))"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tag</th>\n",
       "      <th>ts</th>\n",
       "      <th>user</th>\n",
       "      <th>tagID</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>4792597</th>\n",
       "      <td>js</td>\n",
       "      <td>1332565200</td>\n",
       "      <td>95315</td>\n",
       "      <td>549314</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6900998</th>\n",
       "      <td>ongod</td>\n",
       "      <td>1332565200</td>\n",
       "      <td>134826</td>\n",
       "      <td>761791</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>264287</th>\n",
       "      <td>3daysuntilboyfriend</td>\n",
       "      <td>1332565200</td>\n",
       "      <td>112546</td>\n",
       "      <td>15262</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9055159</th>\n",
       "      <td>stopthat</td>\n",
       "      <td>1332565200</td>\n",
       "      <td>279120</td>\n",
       "      <td>970235</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7714792</th>\n",
       "      <td>proud</td>\n",
       "      <td>1332565200</td>\n",
       "      <td>95315</td>\n",
       "      <td>819315</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                         tag          ts    user   tagID\n",
       "4792597                   js  1332565200   95315  549314\n",
       "6900998                ongod  1332565200  134826  761791\n",
       "264287   3daysuntilboyfriend  1332565200  112546   15262\n",
       "9055159             stopthat  1332565200  279120  970235\n",
       "7714792                proud  1332565200   95315  819315"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dfs = []\n",
    "with open('/nfs/maciej/twitter/Prediction_of_Viral_Memes_on_Twitter/timeline_tag.anony.dat', 'rb') as f:\n",
    "    reader = codecs.getreader(\"utf-8\")\n",
    "    contents = reader(f)\n",
    "    for line in tqdm(contents):\n",
    "        split=line.split(\" \")\n",
    "        length=len(split)\n",
    "        for i in range(1,length-1):\n",
    "            split2=split[i].split(\",\")\n",
    "            dfs.append([split[0],split2[0],split2[1]])\n",
    "        split2=split[length-1].split(\",\")\n",
    "        dfs.append([split[0],split2[0],split2[1][:-1]])\n",
    "df_tag=pd.DataFrame(dfs)\n",
    "del dfs\n",
    "del split\n",
    "del split2\n",
    "del length\n",
    "df_tag.columns=['tag','ts','user']\n",
    "from collections import defaultdict\n",
    "d = defaultdict(lambda: len(d))\n",
    "df_tag['tagID'] = df_tag.progress_apply(lambda row: d[row['tag']], axis=1)\n",
    "df_tag['ts']=df_tag['ts'].astype(int)\n",
    "df_tag['user']=df_tag['user'].astype(int)\n",
    "df_tag.sort_values(by=['ts'], axis=0, ascending=True, inplace=True, kind='quicksort', na_position='last')\n",
    "df_tag.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### timeline_tag_rt.anony.dat"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "e58b1f35a4fa4af89205f8e3e15b165a",
       "version_major": 2,
       "version_minor": 0
      },
      "text/html": [
       "<p>Failed to display Jupyter Widget of type <code>HBox</code>.</p>\n",
       "<p>\n",
       "  If you're reading this message in Jupyter Notebook or JupyterLab, it may mean\n",
       "  that the widgets JavaScript is still loading. If this message persists, it\n",
       "  likely means that the widgets JavaScript library is either not installed or\n",
       "  not enabled. See the <a href=\"https://ipywidgets.readthedocs.io/en/stable/user_install.html\">Jupyter\n",
       "  Widgets Documentation</a> for setup instructions.\n",
       "</p>\n",
       "<p>\n",
       "  If you're reading this message in another notebook frontend (for example, a static\n",
       "  rendering on GitHub or <a href=\"https://nbviewer.jupyter.org/\">NBViewer</a>),\n",
       "  it may mean that your frontend doesn't currently support widgets.\n",
       "</p>\n"
      ],
      "text/plain": [
       "HBox(children=(IntProgress(value=1, bar_style='info', max=1), HTML(value='')))"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tag</th>\n",
       "      <th>ts</th>\n",
       "      <th>user1</th>\n",
       "      <th>user2</th>\n",
       "      <th>tagID</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>007april</td>\n",
       "      <td>1334059940</td>\n",
       "      <td>402537</td>\n",
       "      <td>80192</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>007april14</td>\n",
       "      <td>1333275738</td>\n",
       "      <td>402537</td>\n",
       "      <td>2453</td>\n",
       "      <td>12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>007april14</td>\n",
       "      <td>1334016561</td>\n",
       "      <td>402537</td>\n",
       "      <td>2453</td>\n",
       "      <td>12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>007friday</td>\n",
       "      <td>1334537275</td>\n",
       "      <td>11533</td>\n",
       "      <td>2039</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>007tonight</td>\n",
       "      <td>1332631375</td>\n",
       "      <td>254678</td>\n",
       "      <td>267967</td>\n",
       "      <td>30</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          tag          ts   user1   user2  tagID\n",
       "0    007april  1334059940  402537   80192     11\n",
       "1  007april14  1333275738  402537    2453     12\n",
       "2  007april14  1334016561  402537    2453     12\n",
       "3   007friday  1334537275   11533    2039     16\n",
       "4  007tonight  1332631375  254678  267967     30"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dfs = []\n",
    "with open('/nfs/maciej/twitter/Prediction_of_Viral_Memes_on_Twitter/timeline_tag_rt.anony.dat', 'rb') as f:\n",
    "    reader = codecs.getreader(\"utf-8\")\n",
    "    contents = reader(f)\n",
    "    for line in tqdm(contents):\n",
    "        split=line.split(\" \")\n",
    "        length=len(split)\n",
    "        for i in range(1,length-1):\n",
    "            split2=split[i].split(\",\")\n",
    "            dfs.append([split[0],split2[0],split2[2],split2[1]])\n",
    "        split2=split[length-1].split(\",\")\n",
    "        dfs.append([split[0],split2[0],split2[2][:-1],split2[1]])\n",
    "df_tag_rt=pd.DataFrame(dfs)\n",
    "del dfs\n",
    "del split\n",
    "del split2\n",
    "del length\n",
    "df_tag_rt.columns=['tag','ts','user1','user2']\n",
    "df_tag_rt['tagID']=df_tag_rt[\"tag\"].map(d)\n",
    "df_tag_rt.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### timeline_tag_men.anony.dat"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "0965cc37d4bb44dd88e3d3e8ecc6129e",
       "version_major": 2,
       "version_minor": 0
      },
      "text/html": [
       "<p>Failed to display Jupyter Widget of type <code>HBox</code>.</p>\n",
       "<p>\n",
       "  If you're reading this message in Jupyter Notebook or JupyterLab, it may mean\n",
       "  that the widgets JavaScript is still loading. If this message persists, it\n",
       "  likely means that the widgets JavaScript library is either not installed or\n",
       "  not enabled. See the <a href=\"https://ipywidgets.readthedocs.io/en/stable/user_install.html\">Jupyter\n",
       "  Widgets Documentation</a> for setup instructions.\n",
       "</p>\n",
       "<p>\n",
       "  If you're reading this message in another notebook frontend (for example, a static\n",
       "  rendering on GitHub or <a href=\"https://nbviewer.jupyter.org/\">NBViewer</a>),\n",
       "  it may mean that your frontend doesn't currently support widgets.\n",
       "</p>\n"
      ],
      "text/plain": [
       "HBox(children=(IntProgress(value=1, bar_style='info', max=1), HTML(value='')))"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tag</th>\n",
       "      <th>ts</th>\n",
       "      <th>user1</th>\n",
       "      <th>user2</th>\n",
       "      <th>tagID</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>00000000000gcf</td>\n",
       "      <td>1334561209</td>\n",
       "      <td>66414</td>\n",
       "      <td>409938</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>007april14</td>\n",
       "      <td>1333072769</td>\n",
       "      <td>402537</td>\n",
       "      <td>212232</td>\n",
       "      <td>12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>007april14</td>\n",
       "      <td>1333142891</td>\n",
       "      <td>402537</td>\n",
       "      <td>57787</td>\n",
       "      <td>12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>007april14</td>\n",
       "      <td>1333185894</td>\n",
       "      <td>402537</td>\n",
       "      <td>99848</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>007april14</td>\n",
       "      <td>1333194243</td>\n",
       "      <td>402537</td>\n",
       "      <td>78393</td>\n",
       "      <td>30</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              tag          ts   user1   user2  tagID\n",
       "0  00000000000gcf  1334561209   66414  409938     11\n",
       "1      007april14  1333072769  402537  212232     12\n",
       "2      007april14  1333142891  402537   57787     12\n",
       "3      007april14  1333185894  402537   99848     16\n",
       "4      007april14  1333194243  402537   78393     30"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dfs = []\n",
    "with open('/nfs/maciej/twitter/Prediction_of_Viral_Memes_on_Twitter/timeline_tag_men.anony.dat', 'rb') as f:\n",
    "    reader = codecs.getreader(\"utf-8\")\n",
    "    contents = reader(f)\n",
    "    for line in tqdm(contents):\n",
    "        split=line.split(\" \")\n",
    "        length=len(split)\n",
    "        for i in range(1,length-1):\n",
    "            split2=split[i].split(\",\")\n",
    "            dfs.append([split[0],split2[0],split2[1],split2[2]])\n",
    "        split2=split[length-1].split(\",\")\n",
    "        dfs.append([split[0],split2[0],split2[1],split2[2][:-1]])\n",
    "df_tag_men=pd.DataFrame(dfs)\n",
    "del dfs\n",
    "del split\n",
    "del split2\n",
    "del length\n",
    "df_tag_men.columns=['tag','ts','user1','user2']\n",
    "df_tag_men['tagID']=df_tag_rt[\"tag\"].map(d)\n",
    "df_tag_men.head()\n",
    "df_tag_men.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_follower['time']=0\n",
    "df_follower.to_csv('graphFile',sep=' ',columns=['user1','user2','time'],header=False,index=False)\n",
    "del df_follower['time']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_tag.to_csv('actionsFile',sep=' ',columns=['user','tagID','ts'],header=False,index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "np.savetxt(\"trainingActionsFile\", df_tag['tagID'].astype(int).unique(), delimiter=\" \", fmt=\"%d\" )"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Rozkład odstępu czasu między pierwszym, a ostatnim użyciem taga"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "f5aaca6cf0a344cf9e4fa80d7c20019f",
       "version_major": 2,
       "version_minor": 0
      },
      "text/html": [
       "<p>Failed to display Jupyter Widget of type <code>HBox</code>.</p>\n",
       "<p>\n",
       "  If you're reading this message in Jupyter Notebook or JupyterLab, it may mean\n",
       "  that the widgets JavaScript is still loading. If this message persists, it\n",
       "  likely means that the widgets JavaScript library is either not installed or\n",
       "  not enabled. See the <a href=\"https://ipywidgets.readthedocs.io/en/stable/user_install.html\">Jupyter\n",
       "  Widgets Documentation</a> for setup instructions.\n",
       "</p>\n",
       "<p>\n",
       "  If you're reading this message in another notebook frontend (for example, a static\n",
       "  rendering on GitHub or <a href=\"https://nbviewer.jupyter.org/\">NBViewer</a>),\n",
       "  it may mean that your frontend doesn't currently support widgets.\n",
       "</p>\n"
      ],
      "text/plain": [
       "HBox(children=(IntProgress(value=0, description='apply bar', max=1345914), HTML(value='')))"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "(array([ 1023932.,     7607.,     5917.,     7216.,     4301.,     2952.,\n",
       "            3176.,     4553.,     2903.,     2304.,     2928.,     3579.,\n",
       "            2279.,     2143.,     3159.,     2922.,     2007.,     2323.,\n",
       "            3359.,     2309.,     1935.,     2414.,     3356.,     2090.,\n",
       "            1953.,     2870.,     3582.,     2133.,     1934.,     2915.,\n",
       "            2578.,     1784.,     2045.,     3033.,     2083.,     1755.,\n",
       "            2217.,     2717.,     1953.,     1747.,     2552.,     2551.,\n",
       "            1780.,     1816.,     2867.,     2305.,     1761.,     2144.,\n",
       "            2918.,     2068.,     1881.,     2639.,     3453.,     2031.,\n",
       "            1898.,     2778.,     2440.,     1809.,     1917.,     2857.,\n",
       "            2173.,     1746.,     2122.,     2802.,     1972.,     1714.,\n",
       "            2422.,     2534.,     1798.,     1884.,     2727.,     2259.,\n",
       "            1740.,     2044.,     3055.,     2043.,     1841.,     2459.,\n",
       "            3575.,     2035.,     1970.,     2643.,     2670.,     1849.,\n",
       "            1960.,     2777.,     2299.,     1865.,     2136.,     2839.,\n",
       "            2045.,     1921.,     2408.,     2880.,     1979.,     1993.,\n",
       "            2813.,     2671.,     2061.,     2281.,     3209.,     2427.,\n",
       "            2038.,     2640.,     3876.,     2666.,     2246.,     3087.,\n",
       "            3357.,     2410.,     2329.,     3382.,     3000.,     2397.,\n",
       "            2370.,     3709.,     2694.,     2572.,     3404.,     3965.,\n",
       "            2730.,     3232.,     5740.]),\n",
       " array([       0.        ,    23180.40650407,    46360.81300813,\n",
       "           69541.2195122 ,    92721.62601626,   115902.03252033,\n",
       "          139082.43902439,   162262.84552846,   185443.25203252,\n",
       "          208623.65853659,   231804.06504065,   254984.47154472,\n",
       "          278164.87804878,   301345.28455285,   324525.69105691,\n",
       "          347706.09756098,   370886.50406504,   394066.91056911,\n",
       "          417247.31707317,   440427.72357724,   463608.1300813 ,\n",
       "          486788.53658537,   509968.94308943,   533149.3495935 ,\n",
       "          556329.75609756,   579510.16260163,   602690.56910569,\n",
       "          625870.97560976,   649051.38211382,   672231.78861789,\n",
       "          695412.19512195,   718592.60162602,   741773.00813008,\n",
       "          764953.41463415,   788133.82113821,   811314.22764228,\n",
       "          834494.63414634,   857675.04065041,   880855.44715447,\n",
       "          904035.85365854,   927216.2601626 ,   950396.66666667,\n",
       "          973577.07317073,   996757.4796748 ,  1019937.88617886,\n",
       "         1043118.29268293,  1066298.69918699,  1089479.10569106,\n",
       "         1112659.51219512,  1135839.91869919,  1159020.32520325,\n",
       "         1182200.73170732,  1205381.13821138,  1228561.54471545,\n",
       "         1251741.95121951,  1274922.35772358,  1298102.76422764,\n",
       "         1321283.17073171,  1344463.57723577,  1367643.98373984,\n",
       "         1390824.3902439 ,  1414004.79674797,  1437185.20325203,\n",
       "         1460365.6097561 ,  1483546.01626016,  1506726.42276423,\n",
       "         1529906.82926829,  1553087.23577236,  1576267.64227642,\n",
       "         1599448.04878049,  1622628.45528455,  1645808.86178862,\n",
       "         1668989.26829268,  1692169.67479675,  1715350.08130081,\n",
       "         1738530.48780488,  1761710.89430894,  1784891.30081301,\n",
       "         1808071.70731707,  1831252.11382114,  1854432.5203252 ,\n",
       "         1877612.92682927,  1900793.33333333,  1923973.7398374 ,\n",
       "         1947154.14634146,  1970334.55284553,  1993514.95934959,\n",
       "         2016695.36585366,  2039875.77235772,  2063056.17886179,\n",
       "         2086236.58536585,  2109416.99186992,  2132597.39837398,\n",
       "         2155777.80487805,  2178958.21138211,  2202138.61788618,\n",
       "         2225319.02439024,  2248499.43089431,  2271679.83739837,\n",
       "         2294860.24390244,  2318040.6504065 ,  2341221.05691057,\n",
       "         2364401.46341463,  2387581.8699187 ,  2410762.27642276,\n",
       "         2433942.68292683,  2457123.08943089,  2480303.49593496,\n",
       "         2503483.90243902,  2526664.30894309,  2549844.71544715,\n",
       "         2573025.12195122,  2596205.52845528,  2619385.93495935,\n",
       "         2642566.34146341,  2665746.74796748,  2688927.15447155,\n",
       "         2712107.56097561,  2735287.96747968,  2758468.37398374,\n",
       "         2781648.78048781,  2804829.18699187,  2828009.59349594,  2851190.        ]),\n",
       " <a list of 123 Patch objects>)"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZQAAAD8CAYAAABQFVIjAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAE/FJREFUeJzt3X2M3VV+3/H3p3aWkN3A2mBZrkG1V1itzErNLiPDNtGq\nilvb2a1q/mCRV0qxUgukQtNN1Ko1zR+OoEiQPpCiFhIaKIauFhyyFagbSh2zUVVVGIYsWTDE9YSH\ngAvYi73QVloak2//uGfCncFPnXvw9YzfL+mne+739zvnnsMFf/x7mCFVhSRJo/oL456AJGlhMFAk\nSV0YKJKkLgwUSVIXBookqQsDRZLUhYEiSerCQJEkdWGgSJK6WDzuCZxJF198ca1atWrc05CkeeW5\n5577QVUtO9Vx51SgrFq1isnJyXFPQ5LmlSSvn85xXvKSJHVhoEiSujBQJEldGCiSpC4MFElSFwaK\nJKkLA0WS1IWBIknqwkCRJHVxTv2k/ChWbf/On7dfu/2rY5yJJJ2dTnmGkuT+JIeSvDhUW5pkd5ID\n7XXJ0L6bk0wl2Z9k41D9iiQvtH13JUmrn5fkkVbfm2TVUJ+t7TMOJNk6VF/djp1qfT81+j8KSdIo\nTueS1wPAplm17cCeqloD7GnvSbIW2AJc3vrcnWRR63MPcD2wpm3TY24DjlbVZcCdwB1trKXADuBK\nYB2wYyi47gDubH2OtjEkSWN0ykCpqv8KHJlV3gzsbO2dwNVD9Yer6oOqehWYAtYlWQFcUFVPV1UB\nD87qMz3Wo8D6dvayEdhdVU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PjgbIfWNHaK4D9x5s3gyfjvtSO+aOh+teB3xw+prUXM/hBrQwf0/b9\nJvD1Edeyipl/+I5tHW3fD4DFx/t3YIQ1negPqXmzplnzfgz4mwvhuzrOmhbUd3UmNy95ndzxfr3L\nyjHNZbYCfi/Jcxn8NgCA5VX1Vmu/DSxv7ROtY2Vrz67P6FNVx4D3gItOMlZP41zHRcAP27GzxxrV\nLyb5frskNn1paN6tqV22+QKwlwXyXc1aEyyQ7+pMM1Dmr5+pqp9i8NuWb0ry5eGdNfjrzbx/hG+h\nrAO4h8Gl058C3gL+5XinMzdJPgP8DvBLVfX+8L75+l0dZ00L4rsaBwPl5E7r17uMQ1UdbK+HgP/I\n4Lcvv5NkBUB7PdQOP9E6Drb27PqMPkkWAxcC755krJ7GuY53gc+2Y2ePNWdV9U5VfVhVfwb8Owbf\n17xaU5IfY/AH7zer6tutPK+/q+OtaSF8V2Mz7mtuZ/PG4JrnKwxuwE3flL/8LJjXp4GfHGr/d2AT\n8M+ZeYP011r7cmbeTHyFE99M/Eqr38TMm4m7Wnsp8CqDG4lLWnvpiOtZxcz7DWNdB/DbzLwpemOH\nNa0Yav8y8PB8WlObw4PAr8+qz9vv6iRrmtff1Ti3sU/gbN+ArzB4+uOPgV8Z93zanD7X/sX+Q2Df\n9LwYXH/dAxwAfo+hP+iBX2lr2E97AqXVJ4AX275/w0c/7Prj7V/sqfYfy+eG+vzdVp8CfmHEtXyL\nwWWFP2VwvXjbuNfR/vk+0+q/DZzXYU0PAS8A32fwO+dWzLM1/QyDy1nfB55v21fm83d1kjXN6+9q\nnJs/KS9J6sJ7KJKkLgwUSVIXBookqQsDRZLUhYEiSerCQJEkdWGgSJK6MFAkSV38P4j5kh8ud2Cb\nAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f99202d6b38>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.hist(df_tag.groupby(['tagID'])['ts'].progress_apply(lambda row: int(max(row.values))-int(min(row.values))),bins='scott')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Rozkład średniej odstępów czasu między kolejnymi użyciami taga"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "c83b31530c0241859e4202111842fb4c",
       "version_major": 2,
       "version_minor": 0
      },
      "text/html": [
       "<p>Failed to display Jupyter Widget of type <code>HBox</code>.</p>\n",
       "<p>\n",
       "  If you're reading this message in Jupyter Notebook or JupyterLab, it may mean\n",
       "  that the widgets JavaScript is still loading. If this message persists, it\n",
       "  likely means that the widgets JavaScript library is either not installed or\n",
       "  not enabled. See the <a href=\"https://ipywidgets.readthedocs.io/en/stable/user_install.html\">Jupyter\n",
       "  Widgets Documentation</a> for setup instructions.\n",
       "</p>\n",
       "<p>\n",
       "  If you're reading this message in another notebook frontend (for example, a static\n",
       "  rendering on GitHub or <a href=\"https://nbviewer.jupyter.org/\">NBViewer</a>),\n",
       "  it may mean that your frontend doesn't currently support widgets.\n",
       "</p>\n"
      ],
      "text/plain": [
       "HBox(children=(IntProgress(value=0, description='apply bar', max=1345914), HTML(value='')))"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/opt/conda/lib/python3.6/site-packages/numpy/core/fromnumeric.py:2909: RuntimeWarning: Mean of empty slice.\n",
      "  out=out, **kwargs)\n",
      "/opt/conda/lib/python3.6/site-packages/numpy/core/_methods.py:80: RuntimeWarning: invalid value encountered in double_scalars\n",
      "  ret = ret.dtype.type(ret / rcount)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(array([  1.03115800e+06,   1.18320000e+04,   8.64200000e+03,\n",
       "          7.55100000e+03,   7.03700000e+03,   6.15200000e+03,\n",
       "          5.78000000e+03,   5.82100000e+03,   6.50000000e+03,\n",
       "          5.45900000e+03,   4.84900000e+03,   4.60300000e+03,\n",
       "          4.59500000e+03,   4.57200000e+03,   4.42500000e+03,\n",
       "          4.42500000e+03,   4.64400000e+03,   5.04000000e+03,\n",
       "          4.37900000e+03,   4.15300000e+03,   4.20600000e+03,\n",
       "          4.00100000e+03,   3.83700000e+03,   3.82500000e+03,\n",
       "          3.92300000e+03,   4.32500000e+03,   3.88800000e+03,\n",
       "          3.60700000e+03,   3.45500000e+03,   3.40000000e+03,\n",
       "          3.63400000e+03,   3.20300000e+03,   3.15100000e+03,\n",
       "          3.00600000e+03,   3.84900000e+03,   2.94800000e+03,\n",
       "          3.02100000e+03,   2.80600000e+03,   2.85800000e+03,\n",
       "          2.74700000e+03,   2.66700000e+03,   2.59400000e+03,\n",
       "          2.77400000e+03,   2.98600000e+03,   2.39200000e+03,\n",
       "          2.32400000e+03,   2.22000000e+03,   2.19900000e+03,\n",
       "          2.10700000e+03,   2.10400000e+03,   2.10000000e+03,\n",
       "          2.78600000e+03,   2.15300000e+03,   1.89400000e+03,\n",
       "          1.82000000e+03,   1.79900000e+03,   1.86400000e+03,\n",
       "          1.79000000e+03,   1.81700000e+03,   2.02200000e+03,\n",
       "          2.78100000e+03,   1.69800000e+03,   1.66200000e+03,\n",
       "          1.56800000e+03,   1.70500000e+03,   1.36500000e+03,\n",
       "          1.44800000e+03,   1.29900000e+03,   1.74000000e+03,\n",
       "          1.64300000e+03,   1.26100000e+03,   1.19000000e+03,\n",
       "          1.15100000e+03,   1.22900000e+03,   1.11800000e+03,\n",
       "          1.08600000e+03,   1.27000000e+03,   1.58500000e+03,\n",
       "          1.17600000e+03,   1.01400000e+03,   1.13700000e+03,\n",
       "          1.10800000e+03,   1.05500000e+03,   9.60000000e+02,\n",
       "          9.54000000e+02,   1.12800000e+03,   1.19900000e+03,\n",
       "          8.96000000e+02,   8.50000000e+02,   8.27000000e+02,\n",
       "          1.00800000e+03,   7.58000000e+02,   7.33000000e+02,\n",
       "          7.88000000e+02,   1.04900000e+03,   9.06000000e+02,\n",
       "          7.44000000e+02,   6.11000000e+02,   6.94000000e+02,\n",
       "          7.32000000e+02,   6.27000000e+02,   6.17000000e+02,\n",
       "          7.60000000e+02,   9.96000000e+02,   7.19000000e+02,\n",
       "          5.85000000e+02,   6.05000000e+02,   6.41000000e+02,\n",
       "          6.06000000e+02,   5.56000000e+02,   6.18000000e+02,\n",
       "          8.30000000e+02,   8.40000000e+02,   6.06000000e+02,\n",
       "          4.98000000e+02,   5.57000000e+02,   5.87000000e+02,\n",
       "          5.14000000e+02,   5.05000000e+02,   6.37000000e+02,\n",
       "          9.15000000e+02,   6.84000000e+02,   4.65000000e+02,\n",
       "          4.82000000e+02,   4.83000000e+02,   4.29000000e+02,\n",
       "          4.25000000e+02,   4.83000000e+02,   5.45000000e+02,\n",
       "          6.08000000e+02,   4.48000000e+02,   3.77000000e+02,\n",
       "          3.43000000e+02,   3.73000000e+02,   2.92000000e+02,\n",
       "          3.53000000e+02,   3.95000000e+02,   4.99000000e+02,\n",
       "          4.47000000e+02,   3.35000000e+02,   2.64000000e+02,\n",
       "          2.59000000e+02,   2.47000000e+02,   2.35000000e+02,\n",
       "          2.99000000e+02,   3.53000000e+02,   3.82000000e+02,\n",
       "          3.35000000e+02,   2.57000000e+02,   2.52000000e+02,\n",
       "          2.19000000e+02,   2.02000000e+02,   2.09000000e+02,\n",
       "          3.24000000e+02,   3.11000000e+02,   3.39000000e+02,\n",
       "          2.65000000e+02,   2.44000000e+02,   2.33000000e+02,\n",
       "          2.23000000e+02,   2.22000000e+02,   2.11000000e+02,\n",
       "          3.09000000e+02,   3.47000000e+02,   2.85000000e+02,\n",
       "          2.49000000e+02,   1.79000000e+02,   1.72000000e+02,\n",
       "          2.00000000e+02,   1.99000000e+02,   2.29000000e+02,\n",
       "          2.87000000e+02,   3.29000000e+02,   2.57000000e+02,\n",
       "          2.11000000e+02,   1.75000000e+02,   1.83000000e+02,\n",
       "          1.57000000e+02,   1.97000000e+02,   2.64000000e+02,\n",
       "          3.26000000e+02,   3.40000000e+02,   2.04000000e+02,\n",
       "          1.77000000e+02,   1.85000000e+02,   1.73000000e+02,\n",
       "          1.43000000e+02,   1.95000000e+02,   1.95000000e+02,\n",
       "          2.55000000e+02,   2.37000000e+02,   1.89000000e+02,\n",
       "          1.48000000e+02,   1.42000000e+02,   1.28000000e+02,\n",
       "          1.38000000e+02,   1.67000000e+02,   2.05000000e+02,\n",
       "          2.07000000e+02,   1.76000000e+02,   1.57000000e+02,\n",
       "          1.25000000e+02,   1.26000000e+02,   1.30000000e+02,\n",
       "          1.47000000e+02,   1.77000000e+02,   2.02000000e+02,\n",
       "          1.75000000e+02,   1.32000000e+02,   1.37000000e+02,\n",
       "          1.02000000e+02,   1.31000000e+02,   1.19000000e+02,\n",
       "          1.31000000e+02,   1.82000000e+02,   1.84000000e+02,\n",
       "          1.51000000e+02,   1.00000000e+02,   9.50000000e+01,\n",
       "          9.50000000e+01,   9.00000000e+01,   9.40000000e+01,\n",
       "          1.15000000e+02,   1.44000000e+02,   1.49000000e+02,\n",
       "          1.28000000e+02,   1.09000000e+02,   9.00000000e+01,\n",
       "          9.00000000e+01,   9.70000000e+01,   1.06000000e+02,\n",
       "          1.14000000e+02,   1.46000000e+02,   1.01000000e+02,\n",
       "          8.70000000e+01,   7.30000000e+01,   8.40000000e+01,\n",
       "          6.60000000e+01,   8.40000000e+01,   8.20000000e+01,\n",
       "          1.17000000e+02,   1.52000000e+02,   1.00000000e+02,\n",
       "          8.90000000e+01,   5.60000000e+01,   7.40000000e+01,\n",
       "          5.20000000e+01,   5.50000000e+01,   6.50000000e+01,\n",
       "          8.80000000e+01,   9.00000000e+01,   6.40000000e+01,\n",
       "          3.80000000e+01,   4.60000000e+01,   3.60000000e+01,\n",
       "          4.90000000e+01,   4.10000000e+01,   5.60000000e+01,\n",
       "          5.70000000e+01,   5.10000000e+01,   5.50000000e+01,\n",
       "          3.30000000e+01,   2.70000000e+01,   1.90000000e+01,\n",
       "          3.00000000e+01,   3.80000000e+01,   4.00000000e+01,\n",
       "          4.40000000e+01,   2.90000000e+01,   2.10000000e+01,\n",
       "          2.10000000e+01,   2.40000000e+01,   2.20000000e+01,\n",
       "          2.20000000e+01,   1.30000000e+01,   2.00000000e+01,\n",
       "          1.60000000e+01,   1.60000000e+01,   6.00000000e+00,\n",
       "          2.00000000e+00,   8.00000000e+00,   4.00000000e+00,\n",
       "          2.00000000e+00,   4.00000000e+00]),\n",
       " array([       0.        ,    10023.83802817,    20047.67605634,\n",
       "           30071.51408451,    40095.35211268,    50119.19014085,\n",
       "           60143.02816901,    70166.86619718,    80190.70422535,\n",
       "           90214.54225352,   100238.38028169,   110262.21830986,\n",
       "          120286.05633803,   130309.8943662 ,   140333.73239437,\n",
       "          150357.57042254,   160381.4084507 ,   170405.24647887,\n",
       "          180429.08450704,   190452.92253521,   200476.76056338,\n",
       "          210500.59859155,   220524.43661972,   230548.27464789,\n",
       "          240572.11267606,   250595.95070423,   260619.78873239,\n",
       "          270643.62676056,   280667.46478873,   290691.3028169 ,\n",
       "          300715.14084507,   310738.97887324,   320762.81690141,\n",
       "          330786.65492958,   340810.49295775,   350834.33098592,\n",
       "          360858.16901408,   370882.00704225,   380905.84507042,\n",
       "          390929.68309859,   400953.52112676,   410977.35915493,\n",
       "          421001.1971831 ,   431025.03521127,   441048.87323944,\n",
       "          451072.71126761,   461096.54929577,   471120.38732394,\n",
       "          481144.22535211,   491168.06338028,   501191.90140845,\n",
       "          511215.73943662,   521239.57746479,   531263.41549296,\n",
       "          541287.25352113,   551311.0915493 ,   561334.92957746,\n",
       "          571358.76760563,   581382.6056338 ,   591406.44366197,\n",
       "          601430.28169014,   611454.11971831,   621477.95774648,\n",
       "          631501.79577465,   641525.63380282,   651549.47183099,\n",
       "          661573.30985915,   671597.14788732,   681620.98591549,\n",
       "          691644.82394366,   701668.66197183,   711692.5       ,\n",
       "          721716.33802817,   731740.17605634,   741764.01408451,\n",
       "          751787.85211268,   761811.69014085,   771835.52816901,\n",
       "          781859.36619718,   791883.20422535,   801907.04225352,\n",
       "          811930.88028169,   821954.71830986,   831978.55633803,\n",
       "          842002.3943662 ,   852026.23239437,   862050.07042254,\n",
       "          872073.9084507 ,   882097.74647887,   892121.58450704,\n",
       "          902145.42253521,   912169.26056338,   922193.09859155,\n",
       "          932216.93661972,   942240.77464789,   952264.61267606,\n",
       "          962288.45070423,   972312.28873239,   982336.12676056,\n",
       "          992359.96478873,  1002383.8028169 ,  1012407.64084507,\n",
       "         1022431.47887324,  1032455.31690141,  1042479.15492958,\n",
       "         1052502.99295775,  1062526.83098592,  1072550.66901408,\n",
       "         1082574.50704225,  1092598.34507042,  1102622.18309859,\n",
       "         1112646.02112676,  1122669.85915493,  1132693.6971831 ,\n",
       "         1142717.53521127,  1152741.37323944,  1162765.21126761,\n",
       "         1172789.04929577,  1182812.88732394,  1192836.72535211,\n",
       "         1202860.56338028,  1212884.40140845,  1222908.23943662,\n",
       "         1232932.07746479,  1242955.91549296,  1252979.75352113,\n",
       "         1263003.5915493 ,  1273027.42957746,  1283051.26760563,\n",
       "         1293075.1056338 ,  1303098.94366197,  1313122.78169014,\n",
       "         1323146.61971831,  1333170.45774648,  1343194.29577465,\n",
       "         1353218.13380282,  1363241.97183099,  1373265.80985915,\n",
       "         1383289.64788732,  1393313.48591549,  1403337.32394366,\n",
       "         1413361.16197183,  1423385.        ,  1433408.83802817,\n",
       "         1443432.67605634,  1453456.51408451,  1463480.35211268,\n",
       "         1473504.19014085,  1483528.02816901,  1493551.86619718,\n",
       "         1503575.70422535,  1513599.54225352,  1523623.38028169,\n",
       "         1533647.21830986,  1543671.05633803,  1553694.8943662 ,\n",
       "         1563718.73239437,  1573742.57042254,  1583766.4084507 ,\n",
       "         1593790.24647887,  1603814.08450704,  1613837.92253521,\n",
       "         1623861.76056338,  1633885.59859155,  1643909.43661972,\n",
       "         1653933.27464789,  1663957.11267606,  1673980.95070423,\n",
       "         1684004.78873239,  1694028.62676056,  1704052.46478873,\n",
       "         1714076.3028169 ,  1724100.14084507,  1734123.97887324,\n",
       "         1744147.81690141,  1754171.65492958,  1764195.49295775,\n",
       "         1774219.33098592,  1784243.16901408,  1794267.00704225,\n",
       "         1804290.84507042,  1814314.68309859,  1824338.52112676,\n",
       "         1834362.35915493,  1844386.1971831 ,  1854410.03521127,\n",
       "         1864433.87323944,  1874457.71126761,  1884481.54929577,\n",
       "         1894505.38732394,  1904529.22535211,  1914553.06338028,\n",
       "         1924576.90140845,  1934600.73943662,  1944624.57746479,\n",
       "         1954648.41549296,  1964672.25352113,  1974696.0915493 ,\n",
       "         1984719.92957746,  1994743.76760563,  2004767.6056338 ,\n",
       "         2014791.44366197,  2024815.28169014,  2034839.11971831,\n",
       "         2044862.95774648,  2054886.79577465,  2064910.63380282,\n",
       "         2074934.47183099,  2084958.30985915,  2094982.14788732,\n",
       "         2105005.98591549,  2115029.82394366,  2125053.66197183,\n",
       "         2135077.5       ,  2145101.33802817,  2155125.17605634,\n",
       "         2165149.01408451,  2175172.85211268,  2185196.69014084,\n",
       "         2195220.52816901,  2205244.36619718,  2215268.20422535,\n",
       "         2225292.04225352,  2235315.88028169,  2245339.71830986,\n",
       "         2255363.55633803,  2265387.3943662 ,  2275411.23239437,\n",
       "         2285435.07042253,  2295458.9084507 ,  2305482.74647887,\n",
       "         2315506.58450704,  2325530.42253521,  2335554.26056338,\n",
       "         2345578.09859155,  2355601.93661972,  2365625.77464789,\n",
       "         2375649.61267606,  2385673.45070423,  2395697.28873239,\n",
       "         2405721.12676056,  2415744.96478873,  2425768.8028169 ,\n",
       "         2435792.64084507,  2445816.47887324,  2455840.31690141,\n",
       "         2465864.15492958,  2475887.99295775,  2485911.83098592,\n",
       "         2495935.66901408,  2505959.50704225,  2515983.34507042,\n",
       "         2526007.18309859,  2536031.02112676,  2546054.85915493,\n",
       "         2556078.6971831 ,  2566102.53521127,  2576126.37323944,\n",
       "         2586150.21126761,  2596174.04929577,  2606197.88732394,\n",
       "         2616221.72535211,  2626245.56338028,  2636269.40140845,\n",
       "         2646293.23943662,  2656317.07746479,  2666340.91549296,\n",
       "         2676364.75352113,  2686388.5915493 ,  2696412.42957746,\n",
       "         2706436.26760563,  2716460.1056338 ,  2726483.94366197,\n",
       "         2736507.78169014,  2746531.61971831,  2756555.45774648,\n",
       "         2766579.29577465,  2776603.13380282,  2786626.97183099,\n",
       "         2796650.80985915,  2806674.64788732,  2816698.48591549,\n",
       "         2826722.32394366,  2836746.16197183,  2846770.        ]),\n",
       " <a list of 284 Patch objects>)"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZQAAAD8CAYAAABQFVIjAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAE/dJREFUeJzt3X2M3VV+3/H3p3aWkN3A2mBZrkEdr7AamZWaXUaGbaJV\nFbe2s1vV/MEir5RipRZIhaabqFVrmj8cQZEgfSBFLSQ0UAxdLThkK1AIpY7ZqKoqDEOWLBjiesJD\nwAXsxV5oKy2Jybd/3DPhevBT5h58PcP7Jf10z/3+zjn3d7jGH34PM6SqkCRpVH9l3AcgSVoYDBRJ\nUhcGiiSpCwNFktSFgSJJ6sJAkSR1YaBIkrowUCRJXRgokqQuFo/7AM6kCy+8sCYmJsZ9GJI0rzz7\n7LPfr6plp+r3iQqUiYkJpqamxn0YkjSvJHntdPp5yUuS1IWBIknqwkCRJHVhoEiSujBQJEldGCiS\npC4MFElSFwaKJKkLA0WS1IWBcpomtj027kOQpLOagSJJ6uKUgZLk3iQHk7wwVFuaZFeS/e11ydC+\nG5NMJ9mXZMNQ/bIkz7d9dyRJq5+T5KFW35NkYmjMlvYZ+5NsGaqvan2n29hPjf6PQpI0itM5Q7kP\n2Dirtg3YXVWrgd3tPUnWAJuBS9uYO5MsamPuAq4FVrdtZs6twJGqugS4HbitzbUU2A5cDqwFtg8F\n123A7W3MkTaHJGmMThkoVfXfgcOzypuAHa29A7hyqP5gVb1fVa8A08DaJCuA86r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F8MXW/nHgf7Vjn+/f1YnWNa+/r3Ft\nYz+As3kDvgQ8MfT+RuDGcR9XO5ZX+Wig7ANWtPYKYN/xjpvBk3Ffan3+aKj+deA3hvu09mIGP6iV\n4T5t328AXx9xLRMc+5fv2NbR9n0fWHy8PwMjrOlEf0HNmzXNOu5HgL+zEL6rE6xrQX1fZ2rzktfJ\nHe/Xu6wc07HMVsDvJXk2g98GALC8qt5s7beA5a19onWsbO3Z9WPGVNVR4F3ggpPM1dM413EB8IPW\nd/Zco/qFJN9rl8RmLg3NuzW1SzZfAPawgL6rWeuCBfJ9nUkGyvz101X1kwx+2/INSb48vLMG/2kz\n7x/hWyjrAO5icOn0J4E3gX8z3sOZmySfAX4b+MWqem9433z+ro6zrgXxfZ1pBsrJndavdxmHqjrQ\nXg8C/4XBb19+O8kKgPZ6sHU/0ToOtPbs+jFjkiwGzgfeOclcPY1zHe8An219Z881Z1X1dlV9UFV/\nDvxHBt/XvFpTkh9h8JfuN6vq260877+r461rIXxfYzHua25n88bgeufLDG6+zdyUv/QsOK5PAz8+\n1P6fwEbgX3HsDdJfbe1LOfZG4suc+EbiV1r9Bo69kbiztZcCrzC4ibiktZeOuJ4Jjr3fMNZ1AL/F\nsTdEr++wphVD7V8CHpxPa2rHcD/wa7Pq8/q7Osm65vX3Na5t7Adwtm/AVxg8+fHHwC+P+3jaMX2u\n/aH+Q2DvzHExuPa6G9gP/B5Df9EDv9zWsI/29EmrTwIvtH3/ng9/2PVH2x/q6fYvyueGxvyDVp8G\nfn7EtXyLwSWFP2NwrXjruNfR/vk+3eq/BZzTYU0PAM8D32PwO+dWzLM1/TSDy1nfA55r21cWwHd1\nonXN6+9rXJs/KS9J6sJ7KJKkLgwUSVIXBookqQsDRZLUhYEiSerCQJEkdWGgSJK6MFAkSV38f1qk\nmxvjimcOAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f99bb125160>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.hist(df_tag.groupby(['tagID'])['ts'].progress_apply(lambda row: np.nan_to_num(np.nanmean(np.diff(np.sort(row.values))))),bins='scott')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
